#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>


typedef struct Node{
    int val;
    struct Node* next;
    struct Node* random;

}Node;


struct Node* copyRandomList(struct Node* head) {

    struct Node* cur = head, * curnext = cur->next, * new = NULL;
    while (cur)
    {
        new = (struct Node*)malloc(sizeof(struct Node));
        cur->next = new;
        new->next = curnext;
        new->val = cur->val;

        if (cur->random)
            new->random = cur->random->next;
        else
            new->random = NULL;
        cur = curnext;
        if (curnext != NULL)
            curnext = curnext->next;
    }
    cur = head, curnext = cur->next, new = curnext;
    struct Node* newhead = new;
    while (cur)
    {
        curnext = curnext->next;
        cur->next = curnext;
        cur = cur->next;
        if (curnext != NULL)
            curnext = curnext->next;
        new->next = curnext;
        new = new->next;
    }
    return newhead;
}

int main()
{
 /*   struct Node* n1 = (struct Node*)malloc(sizeof(struct Node));
    struct Node* n2 = (struct Node*)malloc(sizeof(struct Node));
    struct Node* n3 = (struct Node*)malloc(sizeof(struct Node));
    struct Node* n4 = (struct Node*)malloc(sizeof(struct Node));
    struct Node* n5 = (struct Node*)malloc(sizeof(struct Node));

    n1->val = 7;
    n2->val = 13;
    n3->val = 11;
    n4->val = 10;
    n5->val = 1;

    n1->next = n2;
    n2->next = n3;
    n3->next = n4;
    n4->next = n5;
    n5->next = NULL;

    n1->random = NULL;
    n2->random = n1;
    n3->random = n5;
    n4->random = n3;
    n5->random = n1;


    struct Node* new = copyRandomList(n1);

    printf("%d ", n1->random->val);
    printf("%d ", n2->random->val);
    printf("%d ", n3->random->val);
    printf("%d ", n4->random->val);
    printf("%d ", n5->random->val);*/




    typedef int QNDataType;
    typedef struct QueueNode
    {
        QNDataType data;
        struct QueueNode* next;
    }QNode;

    typedef struct Queue
    {
        QNode* head;
        QNode* tail;
        int size;
    }Que;




    typedef struct {
        Que* q1;
        Que* q2;
    } MyStack;


    MyStack m;
    MyStack* n;


    return 0;
}




